import { resultInt, resultPageDataInt } from '@/types/common'
import {
  attrListInt,
  category1Int,
  category2Int,
  category3Int,
  getAttrParamsInt,
  logoInt,
  logoParamsInt
} from '@/types/goods'
import { request } from '@/utils/request'

// 品牌分页
export function getProductBaseTrademark(params: logoParamsInt) {
  return request<resultPageDataInt<logoInt>>({
    url: `/admin/product/baseTrademark/${params.page}/${params.limit}`,
    method: 'GET',
    params
  })
}

/**
 * 保存品牌
 * @param params
 * @returns
 */
export function postAddBaseTrademark(data: logoInt) {
  return request({
    url: '/admin/product/baseTrademark/save',
    method: 'POST',
    data
  })
}
/**
 * 编辑品牌
 * @param params
 * @returns
 */
export function putAddBaseTrademark(data: logoInt) {
  return request({
    url: '/admin/product/baseTrademark/update',
    method: 'PUT',
    data
  })
}

// 分类1分页
export function getCategory1() {
  return request<category1Int[]>({
    url: '/admin/product/getCategory1',
    method: 'GET'
    // params
  })
}
// 分类2分页
export function getCategory2(category1Id: number) {
  return request<category2Int[]>({
    url: `/admin/product/getCategory2/${category1Id}`,
    method: 'GET'
    // params
  })
}

// 分类3分页
export function getCategory3(category2Id: number) {
  return request<category3Int[]>({
    url: `/admin/product/getCategory3/${category2Id}`,
    method: 'GET'
    // params
  })
}
// 获取基础属性列表
export function getAttrList(params: getAttrParamsInt) {
  return request<attrListInt[]>({
    url: `/admin/product/attrInfoList/${params.category1Id}/${params.category2Id}/${params.category3Id}`,
    method: 'GET'
    // params
  })
}
